package Day03;

import java.util.HashMap;
import java.util.HashSet;

public class Day03searchStrSecond {

    public static int search(int[] nums, int target){
        int left = 0,right = nums.length-1;
        int count = 0;

        while (left<right){
            int mid = (right+left)/2;

            if(target>nums[mid]){
                left = mid+1;
            }
            if(target<=nums[mid]){
                right = mid;
            }
        }
        while (left<nums.length&&nums[left++]==target){
            count++;
        }
        return count;
    }
}
